package com.example.itcompanyinterview.tools;

import android.app.ProgressDialog;
import android.content.Context;

public class LoadingDialogHelper {
	private ProgressDialog loadingDialog;
	private Context context;
	
	public LoadingDialogHelper(Context context) {
		this.context = context;
	}
	
	public void showLoadingDialog() {
		String title = "加载中";
		String msg = "请稍候...";
		this.showLoadingDialog(title, msg);
	}
	
	public void showLoadingDialog(String title, String msg) {
		this.loadingDialog = new ProgressDialog(context);
    	this.loadingDialog.setTitle(title);
    	this.loadingDialog.setMessage(msg);
		this.loadingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
		this.loadingDialog.show();
	}
	
	public void closeLoadingDialog() {
		if(this.loadingDialog != null && this.loadingDialog.isShowing()) {
			this.loadingDialog.dismiss();
		}
	}

}
